package com.dut.bbs.adapter;

import java.util.HashMap;

import android.content.Context;

import com.dut.bbs.R;

public class Face {  
    
    public static String[] faceNames = new String[] {"em1","em2"};  //每个表情的标示
  
    private static HashMap<String, Integer> faces;  //表情名到资源ID的映射
  
    public static HashMap<String, Integer> getfaces(Context context) {  
        if (faces != null) {  
            return faces;  
        }  
        faces = new HashMap<String, Integer>();  
//        String faceName = "";  
//        for (int i = 217; i <= 290; i++) {  
//            faceName = "face" + i;  
//            try {  
//                int id = R.drawable.class.getDeclaredField(faceName).getInt(  
//                        context);  
//                faces.put(faceNames[i - 217], id);  
//            } catch (IllegalArgumentException e) {  
//                e.printStackTrace();  
//            } catch (SecurityException e) {  
//                e.printStackTrace();  
//            } catch (IllegalAccessException e) {  
//                e.printStackTrace();  
//            } catch (NoSuchFieldException e) {  
//                e.printStackTrace();  
//            }  
//        }  
  
        faces.put("em1", R.drawable.em1);  
        faces.put("em2", R.drawable.em2);  
        return faces;  
    } 
}
